#ifndef __EKOS_KERNEL_INTR_H__
#define __EKOS_KERNEL_INTR_H__

int intr_init(void);
int intr_init_ap(void);

#define IDT_COUNT       256
#define ISR_COUNT       32

/* The system level function prototype of irq interrupt handler */
typedef int(*irq_handler_t)(struct trapframe_t*);
/* and for exception handler */
typedef void(*ex_handler_t)(struct trapframe_t*);

/* Register handler for responding interrupt */
void register_ex_handler(uint32_t n, ex_handler_t h);
void register_irq_handler(uint32_t irq, irq_handler_t h);

int  get_irq_ap(uint32_t irq);
void set_irq_ap(uint32_t irq, int ap);

/* Use by intr.c, the func table for handling exception and irq
 * request */
extern volatile ex_handler_t		ex_handlers[ISR_COUNT];
extern volatile irq_handler_t	irq_handlers[IRQ_COUNT];
extern volatile int				irq_ap[IRQ_COUNT];
extern volatile kpipe_t          *irq_pipes;

void enable_irq_line(int irq);
void disable_irq_line(int irq);

void set_soft_timer(uint32_t alarm, int pid);

#endif
